package leetcode;

public class Tese26 {
    class Solution {
        public int removeDuplicates(int[] nums) {
            //快慢指针法
            int i = 0;
            int j = 1;
            if(nums.length <= 1) return nums.length;
            while(i < nums.length && j< nums.length){
                if(nums[i] != nums[j]){
                    nums[i+1] = nums[j];
                    i++;
                }
                j++;
            }
            return i+1;
        }
    }
}
